package com.simpdo.crazyshopping;

import android.media.Image;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.TextView;

import java.util.List;

/**
 * Created by adi on 2017/1/6.
 */

class GoodsItem{
    private String mName;
    private String mSale;
    private String mImageUrl;

    public GoodsItem(String name, String sale, String imageUrl) {
        this.mName = name;
        this.mSale = sale;
        this.mImageUrl = imageUrl;
    }

    public String getmName() {
        return mName;
    }

    public String getmSale() {
        return mSale;
    }

    public String getmImageUrl() {
        return mImageUrl;
    }
}

public class GoodsListFragment extends Fragment {
    ListView mListView = null;
    List<GoodsItem> mGoodsList = null;
    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_goods_list, container, false);
        mListView = (ListView) view.findViewById(R.id.goods_list);
        return super.onCreateView(inflater, container, savedInstanceState);
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
    }

    class ViewHolder {
        public TextView nameView;
        public TextView saleView;
        public ImageView imageView;
    }

    class GoodsItemAdapter extends BaseAdapter {
        @Override
        public int getCount() {
            return mGoodsList.size();
        }

        @Override
        public Object getItem(int i) {
            return null;
        }

        @Override
        public long getItemId(int i) {
            return i;
        }

        @Override
        public View getView(int i, View view, ViewGroup viewGroup) {
            ViewHolder viewHolder;
            if (null == view) {

            }
            return null;
        }
    }
}
